package com.example.shushiyunsst.fragment.main.home.child.icon_sst

import android.annotation.SuppressLint
import android.content.Context
import android.view.View
import android.widget.TextView
import com.example.shushiyunsst.R
import com.example.shushiyunsst.fragment.main.home.child.icon_sst.bean.*
import com.lxj.xpopup.core.CenterPopupView

class CurrencyTransferBuyStatusPop(context: Context) : CenterPopupView(context) {

    override fun getImplLayoutId(): Int {
        return R.layout.currency_transfer_buy_status_pop
    }

    private var mBean: CurrencyOrderInfoBean? = null

    fun setBean(mBean: CurrencyOrderInfoBean?): CurrencyTransferBuyStatusPop {
        this.mBean = mBean
        return this
    }

    private var callBackListener: CallBackListener? = null

    fun setCallBackListener(callBackListener: CallBackListener?): CurrencyTransferBuyStatusPop {
        this.callBackListener = callBackListener
        return this
    }

    @SuppressLint("SetTextI18n")
    override fun onCreate() {
        super.onCreate()

        val payingWayTv: TextView = findViewById(R.id.payingWayTv)
        payingWayTv.text = when (mBean?.payWay) {
            WEI_CHAT_PAY -> "微信支付"
            A_LI_PAY -> "支付宝支付"
            BANK_PAY -> "银行卡支付"
            else -> ""
        }

        val payeeTv: TextView = findViewById(R.id.payeeTv)
        payeeTv.text = mBean?.realName

        val moneyTv: TextView = findViewById(R.id.moneyTv)
        moneyTv.text = "${mBean?.totalPrice22} ${mBean?.tokenType}"

        findViewById<View>(R.id.cancel_action).setOnClickListener {
            dismiss()
        }

        findViewById<View>(R.id.sure_action).setOnClickListener {
            callBackListener?.sureAction()
            dismiss()
        }
    }

    interface CallBackListener {
        fun sureAction()
    }

}